﻿@namespace Bit.BlazorUI
@inherits BitComponentBase

<button @ref="RootElement" @attributes="HtmlAttributes" @onclick="HandleOnClick"
        id="@_Id"
        style="@StyleBuilder.Value"
        class="@ClassBuilder.Value"
        dir="@Dir?.ToString().ToLower()"
        type="button"
        title="@GetTitle()"
        tabindex="@_tabIndex"
        aria-label="@AriaLabel"
        aria-hidden="@AriaHidden"
        aria-describedby="@AriaDescription">
    @if (ChildContent is not null)
    {
        @ChildContent
    }
    else
    {
        var iconName = GetIconName();
        var text = GetText();
        if (iconName.HasValue())
        {
            <i style="@Styles?.Icon" class="bit-tgb-ico bit-icon bit-icon--@iconName @Classes?.Icon" />
        }

        if (IconOnly is false && text.HasValue())
        {
            <span style="@Styles?.Text" class="bit-tgb-btx @Classes?.Text">@text</span>
        }
    }
</button>
